<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2022/9/29
  Time: 10:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>用户列表信息</title>
    <link href="${pageContext.request.contextPath}/css/reset.css" type="text/css" rel="stylesheet"/>
    <link href="${pageContext.request.contextPath}/css/bootstrap.min.css" type="text/css" rel="stylesheet"/>
</head>
<body>
    <div>
        <div class="panel panel-default">
            <!-- Default panel contents -->
            <div class="panel-heading">用户列表信息</div>
            <div class="panel-body">
                <p>${errMsg}</p>
            </div>
            <!-- Table -->
            <table class="table">
                <tr>
                    <th>用户id</th>
                    <th>用户名</th>
                    <th>用户地址</th>
                    <th>用户创建时间</th>
                    <th>用户修改时间</th>
                    <th>用户角色</th>
                    <th>用户头像</th>
                    <th>操作</th>
                </tr>
                <c:forEach items="${page.data}" var="stu">
                    <tr>
                        <td>${stu.id}</td>
                        <td>${stu.username}</td>
                        <td>${stu.address}</td>
                        <td>${stu.createTime}</td>
                        <td>${stu.updateTime}</td>
                        <td>${stu.roleName}</td>
                        <td>
                            <img src="${stu.avatar}" width="20" height="20" style="border-radius: 50%"/>
                        </td>
                        <td>
                            <a href="#">删除</a>
                            <a href="#">修改</a>
                        </td>
                    </tr>
                </c:forEach>
            </table>
            <nav aria-label="Page navigation" style="float: right">
                <ul class="pagination">
                    <c:choose>
                        <c:when test="${page.pageNum > 1}">
                            <li>
                                <a href="${pageContext.request.contextPath}/user?method=userListPage&pageNum=${page.pageNum-1}&pageSize=${page.pageSize}" aria-label="Previous">
                                    <span aria-hidden="true">&laquo;</span>
                                </a>
                            </li>
                        </c:when>
                        <c:otherwise><!-- 如果 -->
                            <li class="disabled">
                                <a href="javascript:void(0)" aria-label="Previous">
                                    <span aria-hidden="true">&laquo;</span>
                                </a>
                            </li>
                        </c:otherwise>
                    </c:choose>
                    <c:forEach begin="1" end="${page.pages}" var="item">
                        <c:choose>
                            <c:when test="${item == page.pageNum}">
                                <li class="active"><a style="cursor: pointer" href="${pageContext.request.contextPath}/user?method=userListPage&pageNum=${item}&pageSize=${page.pageSize}">${item}</a></li>
                            </c:when>
                            <c:otherwise>
                                <li><a style="cursor: pointer" href="${pageContext.request.contextPath}/user?method=userListPage&pageNum=${item}&pageSize=${page.pageSize}">${item}</a></li>
                            </c:otherwise>
                        </c:choose>
                    </c:forEach>

                    <c:choose>
                        <c:when test="${page.pageNum < page.pages}">
                            <li>
                                <a href="${pageContext.request.contextPath}/user?method=userListPage&pageNum=${page.pageNum+1}&pageSize=${page.pageSize}" aria-label="Next">
                                    <span aria-hidden="true">&raquo;</span>
                                </a>
                            </li>
                        </c:when>
                        <c:otherwise><!-- 如果 -->
                            <li class="disabled">
                                <a href="javascript:void(0)" aria-label="Next">
                                    <span aria-hidden="true">&raquo;</span>
                                </a>
                            </li>
                        </c:otherwise>
                    </c:choose>
                </ul>
            </nav>
        </div>
    </div>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
</body>
</html>
